---
title: "Replication: Jankowski/Rehmert EJPR 2024"
author:
  - name: Michael Jankowski
  - name: Jochen Rehmert
date: 
  value: 20/08/2024
  format: 'DD MMMM, YYYY'
toc: true
toc-title: "Content"
reference-location: margin
number-sections: true
execute: 
  cache: true
format:
  html:
    grid:
      sidebar-width: 300px
      body-width: 900px
      margin-width: 300px
      gutter-width: 1.5rem
    self-contained: true
    code-fold: true
editor_options: 
  chunk_output_type: console
---

## About

This quarto document provides all code for replicating the paper:

Jankowski, Michael & Jochen Rehmert. 2024. Ranking and Selecting Women under PR: Evidence from a Two-Stage Conjoint Experiment. *European Journal of Political Research*. (currently, as of preparing this replication data, only accepted, so no DOI).

The data comes with the replication zip-file. The data is preprocessed and should not contain any information to identify the respondents. We have scripts which take the original Qualtrics survey file and transform the data in the final format used for the analysis. The replication data contains lots of additional variables which were used while programming the experiment, but which are of no relevance for the analysis.

To run the replication follow these steps:

1.  Install R and R Studio.
2.  Open the RStudio project that comes with the zip file.
3.  Open the .qmd file.
4.  Run the different cells to replicate the respective tables and figures.

In case of any questions, please contact Michael: michael.jankowski\@uol.de

The code was last run using R 4.4.1. At the end of the file a full description is provided.

## Packages and Data

```{r}

library(tidyverse)
library(cjoint)
library(rvest)
library(haven)
library(cregg)
library(margins)
library(MNLpred)
library(nnet) 
library(MASS) 
library(scales)
library(ggh4x)
library(data.table)
library(fastDummies)
library(rio)
library(texreg)

respondents <- rio::import("respondents.csv")

df <- readRDS("long_data_prep.rds")

color_fill <- colorRampPalette(c("#010b8c", "#b882fa"))

df %>%
  group_by(ResponseID) %>%
  mutate(n_women = sum(fct_gender == "Female")) -> df

df$respondent_party <- case_when(df$respondent_party == "Gruene" ~ 1,
                                 df$respondent_party == "NEOS" ~ 2,
                                 df$respondent_party == "SPO" ~ 3,
                                 df$respondent_party == "OVP" ~ 4,
                                 df$respondent_party == "FPO" ~ 5) %>%
  factor(levels = 1:5, labels = c("Greens", "NEOS", "SPÖ", "ÖVP", "FPÖ"))

vorstand <- data.table::fread("vorstände_austria.csv")
```

## Table 1

```{r}
# full party information

table(vorstand$Party) # N Total
table(vorstand$Anrede1) # N Gender (mentioned in text)

respondents %>% 
  group_by(party) %>% 
  count %>%
  ungroup() %>%
  mutate(percent = 100*n/sum(n))
```

## Table 2

We created it manually, so no code.

## Figure 1, Figure 2, Figure 3, Figure A22, Figure A23

```{r}
######################################################
# Probability of Gender on ballot position/selection
######################################################

df$ballotposition_new <- ifelse(is.na(df$ballotposition), 
                                "Deselected",
                                df$ballotposition)

# multinomial predcition packages need dummy variables...

df <-  fastDummies::dummy_cols(df, 
                               select_columns = "fct_gender",
                               remove_first_dummy = TRUE)

df <-  fastDummies::dummy_cols(df, 
                               select_columns = "fct_age",
                               remove_first_dummy = TRUE)

df <-  fastDummies::dummy_cols(df, 
                               select_columns = "fct_deviation",
                               remove_first_dummy = TRUE)

df <-  fastDummies::dummy_cols(df, 
                               select_columns = "fct_experience",
                               remove_first_dummy = TRUE)

df <-  fastDummies::dummy_cols(df, 
                               select_columns = "fct_position",
                               remove_first_dummy = TRUE)

df <-  fastDummies::dummy_cols(df, 
                               select_columns = "fct_issue",
                               remove_first_dummy = TRUE)

df <-  fastDummies::dummy_cols(df, 
                               select_columns = "fct_otherlist",
                               remove_first_dummy = TRUE)

df <-  fastDummies::dummy_cols(df, 
                               select_columns = "fct_personalvotes",
                               remove_first_dummy = TRUE)

names(df) <- gsub("-|/", "", names(df))

# formulas for differen regression models

f0 <- names(df)[grepl("fct_.*?_[A-Za-z]+", names(df))] 
f0 <- f0[f0 != "fct_gender_Male"]
f0 <- paste(f0, collapse = " + ") %>%
  paste("ballotposition_new ~ fct_gender_Male +", .)

f1 <- names(df)[grepl("fct_.*?_[A-Za-z]+", names(df))] 
f1 <- f1[f1 != "fct_gender_Male"]
f1 <- paste(f1, collapse = " + ") %>%
  paste("ballotposition_new ~ fct_gender_Male*n_women +", .)

df$respondent_gender_Male <- as.numeric(df$respondent_gender == "Male")

f2 <- names(df)[grepl("fct_.*?_[A-Za-z]+", names(df))] 
f2 <- f2[f2 != "fct_gender_Male"]
f2 <- paste(f2, collapse = " + ") %>%
  paste("ballotposition_new ~ fct_gender_Male*respondent_gender_Male +", .)

df$lr <- as.numeric(df$qleftright1)

f3 <- names(df)[grepl("fct_.*?_[A-Za-z]+", names(df))] 
f3 <- f3[f3 != "fct_gender_Male"]
f3 <- paste(f3, collapse = " + ") %>%
  paste("ballotposition_new ~ fct_gender_Male*lr +", .)

df$rightwing_party <- as.numeric(df$respondent_party == "FPÖ" | df$respondent_party == "ÖVP")

f4 <- names(df)[grepl("fct_.*?_[A-Za-z]+", names(df))] 
f4 <- f4[f4 != "fct_gender_Male"]
f4 <- paste(f4, collapse = " + ") %>%
  paste("ballotposition_new ~ fct_gender_Male*rightwing_party +", .)

# Baseline Model

mod0 <- multinom(f0, 
                 data = df,
                 Hess = TRUE)

pred0 <- mnl_fd_ova(model = mod0,
                      data = df,
                      x = "fct_gender_Male",
                      by = 1,
                    z = "fct_gender_Male",
                    z_values = c(0, 1),
                    seed = 123123,
                      nsim = 1000, 
                      probs = c(0.025, 0.975))

pd0 <- pred0$plotdata_fd %>%
  filter(fct_gender_Male == 0)

pd0$ballotposition_new <- ifelse(is.na(as.numeric(pd0$ballotposition_new)),
                                 "Deselected",
                                 paste0("Position: ", pd0$ballotposition_new))

pd0$ballotposition_new <- factor(pd0$ballotposition_new,
                                 levels = c(paste0("Position: ",1:6), "Deselected"))
  
color_fill <- colorRampPalette(c("#010b8c", "#b882fa"))

# FIGURE 1

ggplot(data = pd0, aes(x = ballotposition_new, 
                      y = mean,
                      ymin = lower, 
                      ymax = upper,
                      color = ballotposition_new)) +
  geom_hline(yintercept = 0, lty= 2) +
  geom_hline(yintercept = seq(-0.05,0.10,by=0.05), 
             lty= 3,
             color = "grey85") +
  geom_pointrange() +
  coord_flip() +
  xlab("List Position") +
  ylab("Effect of Male vs. Female Aspirant") +
  theme_bw() +
  scale_color_manual(values = color_fill(7)) +
  guides(color = "none") +
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank())

# predicted values

pd0pred <- pred0$plotdata

names(pd0pred)[1] <- "xxx"

pd0pred$ballotposition_new <- ifelse(is.na(as.numeric(pd0pred$ballotposition_new)),
                                     "Deselected",
                                     paste0("Position: ", pd0pred$ballotposition_new))

pd0pred$ballotposition_new <- factor(pd0pred$ballotposition_new,
                                     levels = c(paste0("Position: ",1:6), "Deselected"))


# APPENDIX H

ggplot(data = pd0pred, aes(x = ifelse(fct_gender_Male == 1, "Male", "Female"), 
                           y = mean,
                           ymin = lower, 
                           ymax = upper,
                           color = ballotposition_new)) +
  geom_hline(yintercept = seq(0,0.4,by = 0.1), 
             lty= 3,
             color = "grey85") +
  geom_pointrange(size = .3, position = position_dodge(width = .5)) +
  facet_wrap(~ ballotposition_new) +
  xlab("Aspirant's Gender") +
  ylab("Probability") +
  theme_bw() +
  scale_color_manual("", values = color_fill(7)) + 
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  theme(legend.position = c(0.84,.13),
        legend.box.background = element_rect(fill = "steelblue")) +
  guides(color = "none", shape = "none", fill = "none") +
  coord_flip()

# Model times gender of respondents

mod2 <- multinom(f2, 
                 data = df,
                 Hess = TRUE)

pred2 <- mnl_fd_ova(model = mod2,
                    data = df,
                    x = "respondent_gender_Male",
                    by = 1,
                    z = "fct_gender_Male",
                    z_values = c(0,1),
                    seed = 123123,
                    nsim = 1000, # faster
                    probs = c(0.025, 0.975))

pd2 <- pred2$plotdata_fd 

pd2$ballotposition_new <- ifelse(is.na(as.numeric(pd2$ballotposition_new)),
                                 "Deselected",
                                 paste0("Position: ", pd2$ballotposition_new))

pd2$ballotposition_new <- factor(pd2$ballotposition_new,
                                 levels = c(paste0("Position: ",1:6), "Deselected"))

# FIGURE 3

ggplot(data = pd2, aes(x = ballotposition_new, 
                       y = mean,
                       ymin = lower, 
                       ymax = upper)) +
  geom_vline(aes(xintercept = ballotposition_new), 
             lty= 3,
             color = "grey85") +
  geom_hline(yintercept = 0, lty= 2) +
  geom_pointrange(position = position_dodge(width = 0.5),
                  aes(color = ifelse(respondent_gender_Male == 1, "Male", "Female"),
                      shape = ifelse(respondent_gender_Male == 1, "Male", "Female"))) +
  coord_flip() +
  xlab("List Position") +
  ylab("Effect of Male vs. Female Aspirant") +
  theme_bw() +
  scale_color_manual("Respondent's Gender", values = c("orange",
                                                     "steelblue")) + 
  scale_shape_manual("Respondent's Gender", values = c(15,16)) + 
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  theme(legend.position = "bottom")

pd2pred <- pred2$plotdata

pd2pred$ballotposition_new <- ifelse(is.na(as.numeric(pd2pred$ballotposition_new)),
                                     "Deselected",
                                     paste0("Position: ", pd2pred$ballotposition_new))

pd2pred$ballotposition_new <- factor(pd2pred$ballotposition_new,
                                     levels = c(paste0("Position: ",1:6), "Deselected"))


ggplot(data = pd2pred, aes(x = ifelse(respondent_gender_Male == 1, "Male", "Female"), 
                           y = mean,
                           ymin = lower, 
                           ymax = upper,
                           shape = ifelse(fct_gender_Male == 1, "Male", "Female"),
                           color = ifelse(fct_gender_Male == 1, "Male", "Female"))) +
  geom_hline(yintercept = seq(0,0.4,by = 0.1), 
             lty= 3,
             color = "grey85") +
  geom_pointrange(size = .3, position = position_dodge(width = .5)) +
  facet_wrap(~ ballotposition_new) +
  xlab("Respondent's Gender") +
  ylab("Probability") +
  theme_bw() +
  scale_shape_manual("Aspirant's Gender", values = c(15:16)) + 
  scale_color_manual("Aspirant's Gender", values = c("orange",
                                                     "steelblue")) + 
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  theme(legend.position = c(0.84,.13)) +
  coord_flip()


# Model times supply

mod1 <- multinom(f1, 
                 data = df,
                 Hess = TRUE)

pred1 <- mnl_fd_ova(model = mod1,
                        data = df,
                        x = "n_women",
                        by = 1,
                        z = "fct_gender_Male",
                        z_values = c(0,1),
                        seed = 123123,
                        nsim = 1000, # faster
                        probs = c(0.025, 0.975))

pd1 <- pred1$plotdata_fd

pd1$ballotposition_new <- ifelse(is.na(as.numeric(pd1$ballotposition_new)),
                                 "Deselected",
                                 paste0("Position: ", pd1$ballotposition_new))

pd1$ballotposition_new <- factor(pd1$ballotposition_new,
                                 levels = c(paste0("Position: ",1:6), "Deselected"))

# FIGURE 2

ggplot(data = pd1, aes(x = n_women, 
                       y = mean,
                       ymin = lower, 
                       ymax = upper,
                       fill = ballotposition_new)) +
  geom_hline(yintercept = seq(-.2,.2,by=.1), 
             lty= 3,
             color = "grey85") +
  geom_hline(yintercept = 0, lty= 2) +
  geom_ribbon(alpha = .5) +
  geom_line(color = "white") +
  facet_wrap(~ ballotposition_new) +
  xlab("# Female Aspirants at Stage 1") +
  scale_x_continuous(breaks = 1:8) +
  ylab("Effect of Male vs. Female Aspirant") +
  theme_bw() +
  scale_fill_manual("# Female Aspirtants", values = color_fill(7)) + 
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  theme(legend.position = "bottom") +
  guides(fill = "none")

pd1pred <- pred1$plotdata

pd1pred$ballotposition_new <- ifelse(is.na(as.numeric(pd1pred$ballotposition_new)),
                                 "Deselected",
                                 paste0("Position: ", pd1pred$ballotposition_new))

pd1pred$ballotposition_new <- factor(pd1pred$ballotposition_new,
                                 levels = c(paste0("Position: ",1:6), "Deselected"))


ggplot(data = pd1pred, aes(x = n_women, 
                       y = mean,
                       ymin = lower, 
                       ymax = upper,
                       fill = ifelse(fct_gender_Male == 1, "Male", "Female"),
                       color = ifelse(fct_gender_Male == 1, "Male", "Female"))) +
  geom_hline(yintercept = seq(0,0.4,by = 0.1), 
             lty= 3,
             color = "grey85") +
  geom_ribbon(alpha = .5, color = NA) +
  geom_line(color = "white") +
  facet_wrap(~ ballotposition_new) +
  xlab("# Female Aspirants at Stage 1") +
  scale_x_continuous(breaks = 1:8) +
  ylab("Probability") +
  theme_bw() +
  scale_fill_manual("Aspirant's Gender", values = c("orange",
                                                      "steelblue")) + 
  scale_color_manual("Aspirant's Gender", values = c("orange",
                                                      "steelblue")) + 
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  theme(legend.position = c(0.84,.13))


# Model times leftright

mod3 <- multinom(f3, 
                 data = df,
                 Hess = TRUE)

pred3 <- mnl_fd_ova(model = mod3,
                    data = df,
                    x = "lr",
                    by = 1,
                    z = "fct_gender_Male",
                    z_values = c(0,1),
                    seed = 123123,
                    nsim = 1000, # faster
                    probs = c(0.025, 0.975))

pd3 <- pred3$plotdata_fd

pd3$ballotposition_new <- ifelse(is.na(as.numeric(pd3$ballotposition_new)),
                                 "Deselected",
                                 paste0("Position: ", pd3$ballotposition_new))

pd3$ballotposition_new <- factor(pd3$ballotposition_new,
                                 levels = c(paste0("Position: ",1:6), "Deselected"))

# FIGURE A22 (SECTION I)

ggplot(data = pd3, aes(x = lr, 
                       y = mean,
                       ymin = lower, 
                       ymax = upper,
                       fill = ballotposition_new)) +
  geom_hline(yintercept = seq(-.2,.2,by=.1), 
             lty= 3,
             color = "grey85") +
  geom_hline(yintercept = 0, lty= 2) +
  geom_ribbon(alpha = .5) +
  geom_line(color = "white") +
  facet_wrap(~ ballotposition_new) +
  xlab("Left-Right") +
  scale_x_continuous(breaks = 1:10) +
  ylab("Effect of Male vs. Female Aspirant") +
  theme_bw() +
  scale_fill_manual("# Female Aspirtants", values = color_fill(7)) + 
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  theme(legend.position = "bottom") +
  guides(fill = "none")

pd3pred <- pred3$plotdata

pd3pred$ballotposition_new <- ifelse(is.na(as.numeric(pd3pred$ballotposition_new)),
                                     "Deselected",
                                     paste0("Position: ", pd3pred$ballotposition_new))

pd3pred$ballotposition_new <- factor(pd3pred$ballotposition_new,
                                     levels = c(paste0("Position: ",1:6), "Deselected"))

ggplot(data = pd3pred, aes(x = lr, 
                           y = mean,
                           ymin = lower, 
                           ymax = upper,
                           fill = ifelse(fct_gender_Male == 1, "Male", "Female"),
                           color = ifelse(fct_gender_Male == 1, "Male", "Female"))) +
  geom_hline(yintercept = seq(0,0.4,by = 0.1), 
             lty= 3,
             color = "grey85") +
  geom_ribbon(alpha = .5, color = NA) +
  geom_line(color = "white") +
  facet_wrap(~ ballotposition_new) +
  xlab("Left-Right") +
  scale_x_continuous(breaks = 1:10) +
  ylab("Probability") +
  theme_bw() +
  scale_fill_manual("Aspirant's Gender", values = c("orange",
                                                    "steelblue")) + 
  scale_color_manual("Aspirant's Gender", values = c("orange",
                                                     "steelblue")) + 
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  theme(legend.position = c(0.84,.13))

# Model times lr party

mod4 <- multinom(f4, 
                 data = df,
                 Hess = TRUE)

pred4 <- mnl_fd_ova(model = mod4,
                    data = df,
                    x = "rightwing_party",
                    by = 1,
                    z = "fct_gender_Male",
                    z_values = c(0,1),
                    seed = 123123,
                    nsim = 1000, # faster
                    probs = c(0.025, 0.975))

pd4 <- pred4$plotdata_fd 

pd4$ballotposition_new <- ifelse(is.na(as.numeric(pd4$ballotposition_new)),
                                 "Deselected",
                                 paste0("Position: ", pd4$ballotposition_new))

pd4$ballotposition_new <- factor(pd4$ballotposition_new,
                                 levels = c(paste0("Position: ",1:6), "Deselected"))

ggplot(data = pd4, aes(x = ballotposition_new, 
                       y = mean,
                       ymin = lower, 
                       ymax = upper)) +
  geom_vline(aes(xintercept = ballotposition_new), 
             lty= 3,
             color = "grey85") +
  geom_hline(yintercept = 0, lty= 2) +
  geom_pointrange(position = position_dodge(width = 0.5),
                  aes(color = ifelse(rightwing_party == 1, "ÖVP/FPÖ", "NEOS/Greens/SPÖ"),
                      shape = ifelse(rightwing_party == 1, "ÖVP/FPÖ", "NEOS/Greens/SPÖ"))) +
  coord_flip() +
  xlab("List Position") +
  ylab("Effect of Male vs. Female Aspirant") +
  theme_bw() +
  scale_color_manual("Respondent's Party", values = c("orange",
                                                       "steelblue")) + 
  scale_shape_manual("Respondent's Party", values = c(15,16)) + 
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  theme(legend.position = "bottom")

pd4pred <- pred4$plotdata

pd4pred$ballotposition_new <- ifelse(is.na(as.numeric(pd4pred$ballotposition_new)),
                                     "Deselected",
                                     paste0("Position: ", pd4pred$ballotposition_new))

pd4pred$ballotposition_new <- factor(pd4pred$ballotposition_new,
                                     levels = c(paste0("Position: ",1:6), "Deselected"))


ggplot(data = pd4pred, aes(x = ifelse(rightwing_party == 1, "ÖVP/FPÖ", "NEOS/Greens/SPÖ"), 
                           y = mean,
                           ymin = lower, 
                           ymax = upper,
                           shape = ifelse(fct_gender_Male == 1, "Male", "Female"),
                           color = ifelse(fct_gender_Male == 1, "Male", "Female"))) +
  geom_hline(yintercept = seq(0,0.4,by = 0.1), 
             lty= 3,
             color = "grey85") +
  geom_hline(yintercept = 0, lty= 2) +
  geom_pointrange(size = .3, position = position_dodge(width = .5)) +
  facet_wrap(~ ballotposition_new) +
  xlab("Respondent's Party") +
  ylab("Probability") +
  theme_bw() +
  scale_shape_manual("Aspirant's Gender", values = c(15:16)) + 
  scale_color_manual("Aspirant's Gender", values = c("orange",
                                                     "steelblue")) + 
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  theme(legend.position = c(0.84,.13),
        legend.box.background = element_rect(fill = "steelblue"))

# Leftright * Gender

# Model times leftright

dfm <- filter(df, respondent_gender == "Male")
dff <- filter(df, respondent_gender == "Female")

mod3m <- multinom(f3, 
                 data = dfm,
                 Hess = TRUE)

mod3f <- multinom(f3, 
                  data = dff,
                  Hess = TRUE)

pred3m <- mnl_fd_ova(model = mod3m,
                    data = dfm,
                    x = "lr",
                    by = 1,
                    z = "fct_gender_Male",
                    z_values = c(0,1),
                    seed = 123123,
                    nsim = 1000, # faster
                    probs = c(0.025, 0.975))

pred3f <- mnl_fd_ova(model = mod3f,
                     data = dff,
                     x = "lr",
                     by = 1,
                     z = "fct_gender_Male",
                     z_values = c(0,1),
                     seed = 123123,
                     nsim = 1000, # faster
                     probs = c(0.025, 0.975))

pd3m <- pred3m$plotdata_fd
pd3m$respondent_gender <- "Male"
pd3f <- pred3f$plotdata_fd
pd3f$respondent_gender <- "Female"

pd3m_pred <- pred3m$plotdata
pd3m_pred$respondent_gender <- "Male"
pd3f_pred <- pred3f$plotdata
pd3f_pred$respondent_gender <- "Female"

pd3 <- bind_rows(pd3m,pd3f)
pd3_pred <- bind_rows(pd3m_pred,pd3f_pred)

pd3$ballotposition_new <- ifelse(is.na(as.numeric(pd3$ballotposition_new)),
                                 "Deselected",
                                 paste0("Position: ", pd3$ballotposition_new))

pd3$ballotposition_new <- factor(pd3$ballotposition_new,
                                 levels = c(paste0("Position: ",1:6), "Deselected"))

# FIGURE A23

ggplot(data = pd3, aes(x = lr, 
                       y = mean,
                       ymin = lower, 
                       ymax = upper,
                       fill = respondent_gender,
                       color = respondent_gender)) +
  geom_hline(yintercept = seq(-.2,.2,by=.1), 
             lty= 3,
             color = "grey85") +
  geom_hline(yintercept = 0, lty= 2) +
  geom_ribbon(alpha = .5, color = NA) +
  geom_line(color = "white") +
  facet_wrap(~ ballotposition_new) +
  xlab("Left-Right") +
  scale_x_continuous(breaks = 1:10) +
  ylab("Effect of Male vs. Female Aspirant") +
  theme_bw() +
  scale_fill_manual("Respondent's Gender", 
                    values = c("orange",
                               "steelblue")) + 
  scale_color_manual("Respondent's Gender", 
                    values = c("orange",
                               "steelblue")) + 
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  theme(legend.position = c(0.8, 0.15))

pd3_pred$ballotposition_new <- ifelse(is.na(as.numeric(pd3_pred$ballotposition_new)),
                                 "Deselected",
                                 paste0("Position: ", pd3_pred$ballotposition_new))

pd3_pred$ballotposition_new <- factor(pd3_pred$ballotposition_new,
                                 levels = c(paste0("Position: ",1:6), "Deselected"))

ggplot(data = pd3_pred, aes(x = lr, 
                       y = mean,
                       ymin = lower, 
                       ymax = upper,
                       fill = ifelse(fct_gender_Male == 1, "Male", "Female"),
                       color = ifelse(fct_gender_Male == 1, "Male", "Female"))) +
  geom_hline(yintercept = seq(-.2,.5,by=.1), 
             lty= 3,
             color = "grey85") +
  geom_hline(yintercept = 0, lty= 2) +
  geom_ribbon(alpha = .5, color = NA) +
  geom_line(color = "white") +
  facet_grid(respondent_gender ~ ballotposition_new) +
  xlab("Left-Right") +
  scale_x_continuous(breaks = 1:10) +
  ylab("Probability") +
  theme_bw() +
  scale_fill_manual("Aspirant's Gender", 
                    values = c("orange",
                               "steelblue")) + 
  scale_color_manual("Aspirant's Gender", 
                     values = c("orange",
                                "steelblue")) + 
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  theme(legend.position = "bottom") 
```

## TABLE M

```{r, results = "asis"}
# TABLE APPENDIX M

texreg::htmlreg(list(mod0,mod2,mod1,mod3,mod3m,mod3f),
               custom.model.names = c("Base",
                                      "Int. Gender",
                                      "Int. Supply",
                                      "Int. LR",
                                      "Int. LR/Men",
                                      "Int. LR/Women"),
               booktabs = TRUE, longtable = TRUE, 
               caption.above = TRUE,
               fontsize = "tiny")
```

## FRI: FIGURE A8, FIGURE 4, TABLE 3, TABLE A3, FIGURE A4

```{r, results = "asis"}

#####################################
# FRI ANALYSIS
#####################################

# Covariates

library(dplyr)

df$max_einfluss <- apply(dplyr::select(ungroup(df),
                                starts_with("qefficacy")),
                         1,
                         max)

df$age <- 2021 - df$qyob

# Index creation

df$bp_value_female <- 7 - as.numeric(df$ballotposition)
df$bp_value_female[df$fct_gender == "Male"] <- 0

df$lr <- as.numeric(df$qleftright1)

df %>%
  group_by(id, max_einfluss, age, 
           respondent_party, respondent_gender,
           qstrategy, lr) %>%
  summarise(female_index = sum(bp_value_female,
                               na.rm = TRUE),
            n_women = sum(fct_gender == "Female")) -> bp_index

expected_values <- data.frame(mean = c(0:9)*(2/3)*3.5,
                              n_women = 0:9)

bp_index <- left_join(bp_index, expected_values)

bp_index$fri <- bp_index$female_index - bp_index$mean

# plot for appendix

ggplot(bp_index, aes(x = fri)) +
  geom_vline(aes(xintercept = 0), lty = 2) +
  geom_histogram(color = "white", fill = color_fill(40), bins = 40) +
  theme_bw() +
  xlab("FRI") +
  ylab("N") +
  scale_x_continuous(breaks = seq(-6,8,by = 2)) +
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) 

# figure 4

library(ggridges)

ggplot(bp_index, 
       aes(x = fri,
           y = respondent_party,
           fill = respondent_party,
           color = respondent_party)) +
  geom_vline(aes(xintercept = 0), lty = 2, color = "grey50") +
  stat_density_ridges(quantile_lines = TRUE, 
                      quantiles = 2,
                      alpha = .3) +  
  theme_bw(base_size = 14) +
  ylab(NULL) +
  scale_color_manual(values = c("darkgreen",
                                "#e000b7",
                                "darkred",
                                "turquoise",
                                "steelblue")) +
  scale_fill_manual(values = c("darkgreen",
                               "#e000b7",
                               "darkred",
                               "turquoise",
                               "steelblue")) +
  guides(fill = "none", color = "none") +
  xlab("Female Ranking Index (FRI)") +
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank())

# table 3 (ols)

bp_index$n_women <- factor(bp_index$n_women)

ols1 <- lm(fri ~ respondent_gender +
             age +
             respondent_party +
             qstrategy +
             max_einfluss +
             n_women,
           data = bp_index)

ols2 <- lm(fri ~ respondent_gender +
             age +
             lr +
             qstrategy +
             max_einfluss +
             n_women,
           data = bp_index)

texreg::htmlreg(list(ols1,ols2), 
               stars = c(0.1, .05, 0.01),
               booktabs = TRUE,
               #custom.model.names = c("Female Score"),
               caption.above = TRUE,
               caption = "OLS Regression: Explaining Female Friendly Candidate Ranking",
               label = "tab:femfriendly")

# TABLE A3

library(stargazer)

bp_index$male <- as.numeric(bp_index$respondent_gender == "Male")
bp_index$fpoe <- as.numeric(bp_index$respondent_party == "FPÖ")
bp_index$oevp <- as.numeric(bp_index$respondent_party == "ÖVP")
bp_index$greens <- as.numeric(bp_index$respondent_party == "Greens")
bp_index$spoe <- as.numeric(bp_index$respondent_party == "SPÖ")
bp_index$neos <- as.numeric(bp_index$respondent_party == "NEOS")
bp_index$n_women <- as.numeric(bp_index$n_women)
bp_index$lr <- as.numeric(bp_index$lr)

stargazer::stargazer(as.data.frame(bp_index), type = "html")

# FIGURE A4

ggplot(bp_index, aes(x = age)) +
  geom_histogram(color = "white", fill = color_fill(30), bins = 30) +
  theme_bw() +
  ylab("N") +
  xlab("Age")

```

## ZIPPER: FIGURE 5 + APPENDIX G + TABLE 4

```{r, results = "asis"}

####################################
# Ranking Patterns: Zipper Analysis
####################################

df %>%
  filter(!is.na(ballotposition)) %>%
  arrange(id, ballotposition) %>%
  group_by(id) %>%
  summarise(pattern = paste0(fct_gender,
                             collapse = "-")) -> gender_sequences

gender_sequences <- left_join(gender_sequences, 
                              bp_index)

gender_sequences %>%
  group_by(pattern) %>%
  count() %>%
  ungroup() %>%
  mutate(percent = 100*n/sum(n)) %>%
  filter(n > 4) -> overall_pattern

overall_pattern$pattern <- gsub("Male","M",overall_pattern$pattern)
overall_pattern$pattern <- gsub("Female","F",overall_pattern$pattern)

# FIGURE 5

ggplot(overall_pattern,
       aes(x = reorder(pattern, percent),
           y = percent,
           color = reorder(pattern, percent))) +
  geom_hline(yintercept = c(2.5,5,7.5,10),
             color = "grey85",
             lty = 3) +
  geom_segment(aes(x = reorder(pattern, percent), 
                   xend = reorder(pattern, percent), 
                   y = 0, 
                   yend = percent)) +
  geom_point(size=2) +
  coord_flip() +
  xlab("Ranking Sequence") +
  ylab("% of Respondents") +
  theme_bw(base_size = 14) +
  scale_color_manual(values = rev(color_fill(21))) +
  scale_y_continuous(breaks = seq(0,12.5,2.5),
                     expand = expansion(mult = c(0, .1)),
                     labels = c("0","2.5","5",
                                "7.5", "10", "12.5")) +
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  guides(color = "none", fill = "none")

# Ranking By Party (for Appendix G)

gender_sequences %>%
  group_by(pattern, respondent_party) %>%
  count() %>%
  group_by(respondent_party) %>%
  mutate(percent = 100*n/sum(n)) -> overall_pattern

overall_pattern$pattern <- gsub("Male","M",overall_pattern$pattern)
overall_pattern$pattern <- gsub("Female","F",overall_pattern$pattern)

color_fill <- colorRampPalette(c("#010b8c", "#b882fa"))

for(i in unique(overall_pattern$respondent_party)){

  op_x <- filter(overall_pattern, respondent_party == i)

  max_lim <- floor(max(op_x$percent)) +2
  
  ncolors <- nrow(op_x)
  
  ggplot(op_x,
       aes(x = reorder(pattern, percent),
           y = percent,
           color = reorder(pattern, percent))) +
  geom_hline(yintercept = seq(0,max_lim,by = 2),
             color = "grey85",
             lty = 3) +
  geom_segment(aes(x = reorder(pattern, percent), 
                   xend = reorder(pattern, percent), 
                   y = 0, 
                   yend = percent)) +
  geom_point(size=2) +
  coord_flip() +
  xlab("Ranking Sequence") +
  ylab("% of Respondents") +
  theme_bw(base_size = 14) +
  scale_color_manual(values = rev(color_fill(ncolors))) +
  scale_y_continuous(breaks = seq(0,max_lim,2),
                     expand = expansion(mult = c(0, .1))) +
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  guides(color = "none", fill = "none") +
  facet_wrap(~ respondent_party) -> p

  print(p)
  

}

# Ranking By Gender (for appendix)

gender_sequences %>%
  group_by(pattern, respondent_gender) %>%
  count() %>%
  group_by(respondent_gender) %>%
  mutate(percent = 100*n/sum(n)) -> overall_pattern

overall_pattern$pattern <- gsub("Male","M",overall_pattern$pattern)
overall_pattern$pattern <- gsub("Female","F",overall_pattern$pattern)

color_fill <- colorRampPalette(c("#010b8c", "#b882fa"))

for(i in unique(overall_pattern$respondent_gender)){
  
  op_x <- filter(overall_pattern, respondent_gender == i)
  
  max_lim <- floor(max(op_x$percent)) +2
  
  ncolors <- nrow(op_x)
  
  ggplot(op_x,
         aes(x = reorder(pattern, percent),
             y = percent,
             color = reorder(pattern, percent))) +
    geom_hline(yintercept = seq(0,max_lim,by = 2),
               color = "grey85",
               lty = 3) +
    geom_segment(aes(x = reorder(pattern, percent), 
                     xend = reorder(pattern, percent), 
                     y = 0, 
                     yend = percent)) +
    geom_point(size=2) +
    coord_flip() +
    xlab("Ranking Sequence") +
    ylab("% of Respondents") +
    theme_bw(base_size = 14) +
    scale_color_manual(values = rev(color_fill(ncolors))) +
    scale_y_continuous(breaks = seq(0,max_lim,2),
                       expand = expansion(mult = c(0, .1))) +
    theme(panel.grid.minor = element_blank(),
          panel.grid.major = element_blank()) +
    guides(color = "none", fill = "none") +
    facet_wrap(~ respondent_gender) -> p

  print(p)
  
}

# Ranking By Supply (for appendix)

gender_sequences$supply_cat <- case_when(gender_sequences$n_women < 4 ~ "less than 4 women",
                                         gender_sequences$n_women > 5 ~ "more than 5 women",
                                         TRUE ~ "4 or 5 women")

gender_sequences %>%
  group_by(pattern, supply_cat) %>%
  count() %>%
  group_by(supply_cat) %>%
  mutate(percent = 100*n/sum(n)) -> overall_pattern

overall_pattern$pattern <- gsub("Male","M",overall_pattern$pattern)
overall_pattern$pattern <- gsub("Female","F",overall_pattern$pattern)

color_fill <- colorRampPalette(c("#010b8c", "#b882fa"))

for(i in unique(overall_pattern$supply_cat)){
  
  op_x <- filter(overall_pattern, supply_cat == i)
  
  max_lim <- floor(max(op_x$percent)) +2
  
  ncolors <- nrow(op_x)
  
  ggplot(op_x,
         aes(x = reorder(pattern, percent),
             y = percent,
             color = reorder(pattern, percent))) +
    geom_hline(yintercept = seq(0,max_lim,by = 2),
               color = "grey85",
               lty = 3) +
    geom_segment(aes(x = reorder(pattern, percent), 
                     xend = reorder(pattern, percent), 
                     y = 0, 
                     yend = percent)) +
    geom_point(size=2) +
    coord_flip() +
    xlab("Ranking Sequence") +
    ylab("% of Respondents") +
    theme_bw(base_size = 14) +
    scale_color_manual(values = rev(color_fill(ncolors))) +
    scale_y_continuous(breaks = seq(0,max_lim,2),
                       expand = expansion(mult = c(0, .1))) +
    theme(panel.grid.minor = element_blank(),
          panel.grid.major = element_blank()) +
    guides(color = "none", fill = "none") +
    facet_wrap(~ supply_cat) -> p

  print(p)
  
}

# Regression analysis ZIPPER (TABLE 4)

foranalysis <- filter(gender_sequences, n_women >= 3 & n_women <= 6)
foranalysis2 <- filter(gender_sequences, n_women >= 2 & n_women <= 7)

mz <- "Male-Female-Male-Female-Male-Female"
fz <- "Female-Male-Female-Male-Female-Male"
mz2 <- "^Male-Female-Male-Female.*"
fz2 <- "^Female-Male-Female-Male.*"

foranalysis$female_zipper <- as.numeric(foranalysis$pattern == fz)
foranalysis$male_zipper <- as.numeric(foranalysis$pattern == mz)
foranalysis$any_zipper <- as.numeric(foranalysis$pattern == mz | foranalysis$pattern == fz)

foranalysis2$female_zipper <- as.numeric(grepl(fz2, foranalysis2$pattern))
foranalysis2$male_zipper <- as.numeric(grepl(mz2, foranalysis2$pattern))
foranalysis2$any_zipper <- as.numeric(grepl(fz2, foranalysis2$pattern) | grepl(mz2, foranalysis2$pattern))

logit1a <- glm(female_zipper ~ respondent_gender +
                 age +
                 respondent_party +
                 qstrategy +
                 max_einfluss +
                 n_women,
               data = foranalysis2,
               family = binomial("logit"))

logit2a <- glm(male_zipper ~ respondent_gender +
                 age +
                 respondent_party +
                 qstrategy +
                 max_einfluss +
                 n_women,
               data = foranalysis2,
               family = binomial("logit"))

logit3a <- glm(any_zipper ~ respondent_gender +
                 age +
                 respondent_party +
                 qstrategy +
                 max_einfluss +
                 n_women,
               data = foranalysis2,
               family = binomial("logit"))

logit1 <- glm(female_zipper ~ respondent_gender +
                age +
                respondent_party +
                qstrategy +
                max_einfluss +
                n_women,
              data = foranalysis,
              family = binomial("logit"))

logit2 <- glm(male_zipper ~ respondent_gender +
                age +
                respondent_party +
                qstrategy +
                max_einfluss +
                n_women,
              data = foranalysis,
              family = binomial("logit"))

logit3 <- glm(any_zipper ~ respondent_gender +
                age +
                respondent_party +
                qstrategy +
                max_einfluss +
                n_women,
              data = foranalysis,
              family = binomial("logit"))

texreg::htmlreg(list(logit1, logit2, logit3,
                    logit1a, logit2a,logit3a), 
               stars = c(0.1, .05),
               booktabs = TRUE,
               custom.model.names = c("'Female' Zipper",
                                      "'Male' Zipper",
                                      "Any Zipper",
                                      "'Female' Zipper",
                                      "'Male' Zipper",
                                      "Any Zipper"),
               caption.above = TRUE,
               caption = "Logistic Regressions: Explaining Zipper Ranking",
               label = "tab:zipper",
               dcolumn = TRUE)
```

## Appendix C

```{r}
library(tidyverse)
library(rvest)

url <- "https://www.parlament.gv.at/recherchieren/statistiken/personen-statistiken/entw_frauen/NR"
content <- read_html(url)

content %>%
  html_table() %>%
  .[[1]] %>%
  .[-c(1:2),] %>%
  dplyr::select(start = Beginn, "percent" = "%") %>%
  mutate(period = 1:n(),
         percent = gsub("%","",percent) %>% 
           str_trim %>%
           gsub(",",".",.) %>%
           as.numeric) -> xyxy

  ggplot(xyxy,
         aes(x = period,
             y = percent)) +
  geom_point() +
  geom_line() +
  theme_bw() +
  scale_x_continuous(breaks = xyxy$period, 
                     label = gsub("Beginn", "", xyxy$start)) +
  ylab("% Women in Nationalrat") +
  xlab("Start of Legislative Period\n(DD.MM.YYYY)") +
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
```

## Appendix D

Was created manually.

## Appendix E

```{r, results = "asis"}

#####################################################
# Descriptive (Appendix E)
#####################################################

df %>% 
  group_by(max_einfluss) %>%
  count() %>%
  mutate(n = n/9) %>%
  ungroup() %>%
  mutate(percent = 100*n/sum(n)) %>%
  ggplot(aes(x = max_einfluss, y = percent,
             fill = factor(max_einfluss))) +
  geom_col() +
  theme_bw() +
  ylab("%") +
  scale_fill_manual(values = color_fill(7)) +
  xlab("Impact on Candidate Selection") +
  scale_x_continuous(breaks = 1:7,
                     labels = c("min.",rep("...",5),"max.")) +
  guides(fill = "none")

df %>% 
  mutate(qstrategy = as.numeric(qstrategy)) %>%
  group_by(qstrategy) %>%
  count() %>%
  mutate(n = n/9) %>%
  ungroup() %>%
  mutate(percent = 100*n/sum(n)) %>%
  ggplot(aes(x = qstrategy, y = percent,
             fill = factor(qstrategy))) +
  geom_col() +
  theme_bw() +
  ylab("%") +
  xlab("Selection Strategy") +
  scale_x_continuous(breaks = 1:5,
                     labels = c("exclusively\nindividual\ncharacteristics",
                                "...",
                                "both\nequally",
                                "...",
                                "exclusively\nlist\ncomposition")) +
  guides(fill = "none") +
  scale_fill_manual(values = color_fill(5))

df %>% 
  mutate(qstrategy = as.numeric(n_women)) %>%
  group_by(n_women) %>%
  count() %>%
  mutate(n = n/9) %>%
  ungroup() %>%
  mutate(percent = 100*n/sum(n)) %>%
  ggplot(aes(x = n_women, y = percent,
             fill = factor(n_women))) +
  geom_col() +
  theme_bw() +
  ylab("%") +
  xlab("# Women Stage 1") +
  scale_x_continuous(breaks = 1:8) +
  guides(fill = "none") +
  scale_fill_manual(values = color_fill(8)) 

```

## Appendix K

```{r}

####################################################
# AMCE Plot for All CJ Attributes (APPENDIX K)
####################################################

# Baseline Model

f0 <- names(df)[grepl("fct_.*?_[A-Za-z]+", names(df))]

get_amce_mlogit <- function(var = "fct_gender_Male"){
  
  pred0 <- mnl_fd_ova(model = mod0,
                    data = df,
                    x = var,
                    by = 1,
                    z = var,
                    z_values = c(0, 1),
                    seed = 123123,
                    nsim = 100, # faster
                    probs = c(0.025, 0.975))
  
  pd0 <- pred0$plotdata_fd %>% 
    dplyr::filter(get(var) == 1)
  
  pd0$ballotposition_new <- ifelse(is.na(as.numeric(pd0$ballotposition_new)),
                                 "Deselected",
                                 paste0("Position: ", pd0$ballotposition_new))
  
  pd0$ballotposition_new <- factor(pd0$ballotposition_new,
                                 levels = c(paste0("Position: ",1:6), "Deselected"))
  
  pd0[[var]] <- NULL
  
  pd0$fct <- var
 
  pd0
  
}

all_fct <- map_df(f0, get_amce_mlogit)

all_fct$attribute <- str_extract(all_fct$fct,
                                 "^fct_.*?_") %>%
  gsub("fct_|_$", "", .)

all_fct$level <- gsub("^fct_(.*?)_", "", all_fct$fct)

color_fill <- colorRampPalette(c("#010b8c", "#b882fa"))

ggplot(data = all_fct, aes(x = ballotposition_new, 
                       y = mean,
                       ymin = lower, 
                       ymax = upper,
                       color = ballotposition_new)) +
  geom_hline(yintercept = 0, lty= 2) +
  geom_hline(yintercept = seq(-0.2,0.20,by=0.05), 
             lty= 3,
             color = "grey85") +
  geom_pointrange() +
  coord_flip() +
  xlab(NULL) +
  ylab("Effect") +
  theme_bw() +
  scale_color_manual(values = color_fill(7)) +
  guides(color = "none") +
  theme(panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  ggh4x::facet_nested(attribute + level ~ ., 
                      scales  ="free", 
                      space = "free",
                      switch = "y")   +
  scale_x_discrete(position="top") +
  theme(plot.background = element_rect(fill = 'white'),
        axis.text.y = element_text(size=10.5),
        axis.text.x = element_text(angle = 0,
                                   size=10.5),
        strip.text.y = element_text(angle = 90,
                                    size = 10.5),
        strip.text.y.left = element_text(angle = 0),
        strip.background = element_rect(fill = 'white'))
```

## Appendix K

```{r}
flist = list("fct_gender" = "Gender",
             "fct_age" = "Age",
             "fct_issue" = "Policy\nExpertise",
             "fct_deviation" = "Deviation from\nparty",
             "fct_experience" = "Incumbency",
             "fct_personalvotes" = "Personal\nVotes",
             "fct_otherlist" = "Dual\nCandidacy",
             "fct_position" = "Intra-Party\nPosition")


df$pos1 <- ifelse(as.numeric(df$ballotposition) == 1, 1, 0)
df$pos1[is.na(df$pos1)] <- 0

df$pos2 <- ifelse(as.numeric(df$ballotposition) == 2, 1, 0)
df$pos2[is.na(df$pos2)] <- 0

df$pos3 <- ifelse(as.numeric(df$ballotposition) == 3, 1, 0)
df$pos3[is.na(df$pos3)] <- 0

df$pos4 <- ifelse(as.numeric(df$ballotposition) == 4, 1, 0)
df$pos4[is.na(df$pos4)] <- 0

df$pos5 <- ifelse(as.numeric(df$ballotposition) == 5, 1, 0)
df$pos5[is.na(df$pos5)] <- 0

df$pos6 <- ifelse(as.numeric(df$ballotposition) == 6, 1, 0)
df$pos6[is.na(df$pos6)] <- 0

df$region <- case_when(df$ebene1 == 1 ~ 1,
                       df$ebene2 == 1 ~ 2,
                       df$ebene3 == 1 ~ 3,
                       df$ebene4 == 1 ~ 0)
  
####################################
# Descriptive Table (part of table 1)
####################################

respondents %>% 
  group_by(party) %>% 
  count %>%
  ungroup() %>%
  mutate(percent = 100*n/sum(n))

####################################
# Basic AMCE/MM Plots (Appendix K)
####################################

plot_amce_mm <- function(dv = ""){

  df$depvar <- df[[dv]]
  
  mm_base <- cregg::cj(depvar ~ 
                         fct_gender +
                         fct_age +
                         fct_issue + 
                         fct_deviation + fct_personalvotes +
                         fct_experience +
                         fct_position +
                         fct_otherlist,
                       data = df,
                       id = ~ id,
                       estimate = "mm",
                       feature_labels = flist)
  
  amce_base <- cregg::cj(depvar ~ 
                           fct_gender +
                           fct_age +
                           fct_issue + 
                           fct_deviation + fct_personalvotes +
                           fct_experience +
                           fct_position +
                           fct_otherlist,
                         data = df,
                         id = ~ id,
                         estimate = "amce",
                         feature_labels = flist)
  
  mm_base <- bind_rows(mm_base, amce_base)
  
  if(grepl("pos", dv)){
    
    mmline <- 1/9
    
  } else{
    
    mmline <- 1/3
    
  }
  
  hline_data <- data.frame("statistic" = c("AMCE", "MM"),
                           value = c(0,mmline))
  
  mm_base$statistic <- ifelse(mm_base$statistic == "mm",
                              "MM", "AMCE")
  
  ggplot(mm_base, 
         aes(x = level, 
             y = estimate,
             color = feature)) +
    coord_flip() +
    geom_hline(data = hline_data, aes(yintercept = value), lty = 2) +
    geom_point(size = 1.5, 
               position = position_dodge(width = 0.8)) +
    geom_errorbar(aes(ymax = lower, 
                      ymin = upper, 
                      width = 0),
                  position = position_dodge(width = 0.8)) +
    theme_bw() +
    ggh4x::facet_nested(feature ~ statistic, 
                        scales  ="free", 
                        space = "free_y",
                        switch = "y") +
    scale_x_discrete(position="top") +
    theme(plot.background = element_rect(fill = 'white'),
          axis.text.y = element_text(size = 9),
          axis.text.x = element_text(angle = 0,
                                     size = 9),
          strip.text.y = element_text(angle = 90,
                                      size = 9),
          strip.text.y.left = element_text(angle = 0),
          strip.background = element_rect(fill = 'white')) +
    theme(plot.margin=unit(c(1,1,1,3),
                           "line"),
          panel.border = element_rect(colour = "black"),
          legend.position = "bottom") +
    xlab(NULL) +
    ylab(NULL) +
    guides(color = "none") -> p

  print(p)

}

map(c("deselected",paste0("pos",1:6)), plot_amce_mm)
```

## Session info

```{r}
sessionInfo()
```
